xl: correct argument parsing for some sub-commands.
XL sub-commands are expected to parse their arguments relative to the
global variable "optind" rather than treating argc+argv as zero
based. This is because the argc+argv passed to sub-commands include
the entire original command line, not just the sub command specific bits.
Not all commands do this and they are therefore broken if the user
uses "xl -v command", correct such problems
dump-core:
- did not handle "-h" option.
{network,network2,block}-{attach,list,detach} :
- handled arguments without reference to optind
- checked number of arguments before processing getopt loop,
breaking "-h" option handling
An example of the breakage:
# xl -v block-list d32-2
Vdev BE handle state evt-ch ring-ref BE-path
block-list is an invalid domain identifier
51712 0 1 4 13 8 /local/domain/0/backend/vbd/1/
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>